class Quantity < ActiveRecord::Base
  belongs_to :teacher

  #  教师名额信息查询
  def self.select_tea(stu_type)
    find_by_sql(["
    SELECT  q.tea_id, t.tname, q.stu_type, q.numbers
    FROM    teachers t, quantities q
    WHERE   q.tea_id = t.id
    AND     q.stu_type = ?
    ORDER BY q.updated_at DESC
        ", stu_type ])
  end
end
